stage.set_axis(100)
stage.create_grid_overlay(10, "grey")
stage.set_background("soccerfield")
ballx = -80
bally = random.randint(-100,100)
# sprite = codesters.Sprite("image", x, y)
ball = codesters.Sprite("soccerball", ballx, bally)
t = codesters.Teacher()
try:
tval_1 = netx
except:
tval_1 = "DNE"
t1 = TestObjective()
if tval_1 == "DNE":
t1.add_failure(tval_1 == "DNE", "Did you create the integer variable?")
else:
t1.add_success(tval_1 == 90, "Great job!")
t1.add_failure(tval_1 == 25, "Did you change the integer to 90?")
t1.add_failure(tval_1 <= 79, "Too far over! We want to be on the right side of the stage.")
t1.add_failure(tval_1 >= 101, "Too far over! The net will be off the stage!")
t1.add_creative(tval_1 != 90 and tval_1 <= 100 and tval_1 >= 80, "That position is good too!")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)